
<template>
	<div class="app-container">
		<el-card class="box-card">
			<div slot="header" class="box-card-header clearfix">
				<span>功能区</span>
				<template v-for="item in storeConfig.setting.bet_type_list">
					<i style="font-style: normal;padding-left:10px; font-size: 14px;" v-if="item.checked">{{item.label}}</i>
				</template>
				<i style="font-style: normal;padding-left:10px; font-size: 14px;margin-right: 10px;">下注金额：{{storeConfig.setting.bet_amount}}</i>
				<i style="font-style: normal;padding-left:10px; font-size: 14px;margin-right: 10px;">滚球下注金额：{{storeConfig.setting.doing_bet_amount}}</i>
				<el-button size="mini" @click.stop="checkUpgrade">更新版本</el-button>
				<br/>
				{{domain_url}} {{sucOrderCount}} {{storeConfig.setting.suc_order_max_count}}
			</div>
			<el-form :inline="true">
				<el-form-item>
					<el-switch
						@change="switchHasBet"
						v-model="has_bet"
						active-text="开启下注">
					</el-switch>
					<el-switch
						v-model="has_agreement_bet"
						@change="switchHasAgreement"
						active-text="开启协议跟单">
					</el-switch>
					<i :class=" webSocketOnline ? 'el-icon-success' : 'el-icon-warning'" :style=" webSocketOnline ? 'color:#67C23A;' : 'color:#E6A23C'"></i>
				</el-form-item>
				<el-form-item>
					<el-button @click.stop="toHGALogin" :icon="hgaLoginStatus == 0 ? 'el-icon-warning' : (hgaLoginStatus == 1 ? 'el-icon-loading' : 'el-icon-success')" :type="hgaLoginStatus == 0 ? 'warning' : (hgaLoginStatus == 1 ? 'primary' : 'success')">HG登录</el-button>
					<el-button @click.stop="copyHgaLoginUrl">HG复制网址</el-button>
				</el-form-item>
				<el-form-item>
					<el-button @click.stop="toPar987Login" :icon="par987LoginStatus == 0 ? 'el-icon-warning' : (par987LoginStatus == 1 ? 'el-icon-loading' : 'el-icon-success')" :type="par987LoginStatus == 0 ? 'warning' : (par987LoginStatus == 1 ? 'primary' : 'success')">平博登录</el-button>
				</el-form-item>
				<el-form-item>
					平博：[{{par987UserInfo['update_time']}}] {{par987UserInfo['loginId']||""}}：<strong style="color: #67C23A">{{par987UserInfo['betCredit']||""}}</strong> CNY，HG：[{{hgaUserInfo['update_time']}}] {{hgaUserInfo['username']}}：<strong style="color:#67C23A;">{{hgaUserInfo['maxcredit']}}</strong> CNY
				</el-form-item>
				<el-switch
					v-model="has_cancel_bet"
					active-text="出现非投不关闭下注">
				</el-switch>
			</el-form>
		</el-card>
		<div style="height: 20px;"></div>
		<el-card class="box-card container-list">
			<el-tabs v-model="activeName"  @tab-click="handleTabClick">
				<el-tab-pane :label="'赛事列表' + warnDoingCount" name="game">
					<el-table :data="gameHgaList" border style="width: 100%;height: 100%;">
						<el-table-column prop="competition.time_str" label="比赛时间"></el-table-column>
						<el-table-column prop="competition.league" label="联赛"></el-table-column>
						<el-table-column label="队伍">
							<template slot-scope="scope">
								{{scope.row['competition']['team_h']}} <br/>🆚<br/> {{scope.row['competition']['team_c']}}
								<br/><el-tag v-if="scope.row['competition']['diff_time_type'] === 'warn'">赛前</el-tag><el-tag type="success" v-else>滚球</el-tag>
							</template>
						</el-table-column>
						<el-table-column label="全场让球">
							<template slot-scope="scope" v-if="scope.row['concede_points']">
								<strong>{{scope.row['concede_points']['betHdp_h']}}</strong> @ <span style="color: #F56C6C">{{scope.row['concede_points']['odds_h']}}</span>
							<br/>-&#45;&#45;&#45;&#45;<br/>
								<strong>{{scope.row['concede_points']['betHdp_c']}}</strong> @ <span style="color: #F56C6C">{{scope.row['concede_points']['odds_c']}}</span>
							</template>
						</el-table-column>
						<el-table-column label="全场大小球">
							<template slot-scope="scope" v-if="scope.row['min_big']">
								<strong>大 {{scope.row['min_big']['betHdp_h']}}</strong> @ <span style="color: #F56C6C">{{scope.row['min_big']['odds_h']}}</span>
								<br/>-&#45;&#45;&#45;&#45;<br/>
								<strong>小 {{scope.row['min_big']['betHdp_c']}}</strong> @ <span style="color: #F56C6C">{{scope.row['min_big']['odds_c']}}</span>
							</template>
						</el-table-column>
						<el-table-column label="上半场让球">
							<template slot-scope="scope" v-if="scope.row['r_concede_points']">
								<strong>{{scope.row['r_concede_points']['betHdp_h']}}</strong> @ <span style="color: #F56C6C">{{scope.row['r_concede_points']['odds_h']}}</span>
								<br/>-&#45;&#45;&#45;&#45;<br/>
								<strong>{{scope.row['r_concede_points']['betHdp_c']}}</strong> @ <span style="color: #F56C6C">{{scope.row['r_concede_points']['odds_c']}}</span>
							</template>
						</el-table-column>
						<el-table-column label="上半场大小球">
							<template slot-scope="scope" v-if="scope.row['r_min_big']">
								<strong>大 {{scope.row['r_min_big']['betHdp_h']}}</strong> @ <span style="color: #F56C6C">{{scope.row['r_min_big']['odds_h']}}</span>
								<br/>-&#45;&#45;&#45;&#45;<br/>
								<strong>小 {{scope.row['r_min_big']['betHdp_c']}}</strong> @ <span style="color: #F56C6C">{{scope.row['r_min_big']['odds_c']}}</span>
							</template>
						</el-table-column>
						<el-table-column label="平博关联比赛">
							<template slot-scope="scope" v-if="getHgaToPsGameInfo(scope.row)">
								<el-tag>已关联</el-tag>
								<div v-html="getHgaToPsGameInfo(scope.row)"></div>
							</template>
						</el-table-column>
					</el-table>
				</el-tab-pane>
				<el-tab-pane :label="'最近中单_' + storeDiffOrder.betKeys.length " name="order">
					<el-table :data="Object.values(storeDiffOrder.betInfos||{})" border style="width: 100%;height: 100%;">
						<el-table-column prop="bet_time" label="中单时间"></el-table-column>
						<el-table-column label="开赛时间">
							<template slot-scope="scope">
								{{scope.row['hga_team']['time_str']}}
								<br/>
								<span v-if="scope.row['hga_team']['diff_time_type'] === 'warn'">
									<el-tag>赛前</el-tag>{{~~(scope.row['diff_time']/60)}}分{{ scope.row['diff_time'] - ((~~(scope.row['diff_time']/60)) * 60) }}秒
								</span>
								<span v-else>
									<el-tag type="success">滚球</el-tag>{{~~(Math.abs(scope.row['diff_time'])/60)}}分{{ Math.abs(scope.row['diff_time']) - ((~~(Math.abs(scope.row['diff_time'])/60)) * 60) }}秒
								</span>
							</template>
						</el-table-column>
						<el-table-column label="下注盘口">
							<template slot-scope="scope">
								<strong v-if="scope.row['type'].indexOf('concede_points') !== -1">
									{{scope.row['hga_h_amount'] > 0  ? scope.row['hga_team']['team_h'] : scope.row['hga_team']['team_c']}}
								</strong>
								<strong v-if="scope.row['type'].indexOf('min_big') !== -1">
									{{scope.row['hga_h_amount'] > 0  ? '大' : '小'}}
								</strong>
								<br/>
								<strong style="color: #FF7835">{{scope.row['bet_hdp']}}</strong> @ <strong style="color: red">{{scope.row['odds']}}</strong>
							</template>
						</el-table-column>
						<el-table-column label="下注类型">
							<template slot-scope="scope">
							{{betTypeConfig[scope.row['type']]}}
							</template>
						</el-table-column>
						<el-table-column label="交叉盘">
							<template slot-scope="scope">
							
								<div v-if="scope.row['type'].indexOf('min_big') !== -1">
									<div v-if="scope.row['type'] === 'r_min_big'">
										{{scope.row['r_concede_points']['betHdp_h'] < 0 ? '上：让' : '上：受让'}}
										{{scope.row['r_concede_points']['betHdp_h']}} 球 @ {{scope.row['r_concede_points']['odds_h']}}
										<br/>
									</div>
									{{scope.row['concede_points']['betHdp_h'] < 0 ? '全：让' : '全：受让'}}
									{{scope.row['concede_points']['betHdp_h']}} 球 @ {{scope.row['concede_points']['odds_h']}}
								</div>
								
								<div v-if="scope.row['type'].indexOf('concede_points') !== -1">
									<div v-if="scope.row['type'] === 'r_concede_points'">
										上：大 {{scope.row['r_min_big']['betHdp_h']}} @ {{scope.row['r_min_big']['odds_h']}}
										<br/>
									</div>
									全：大 {{scope.row['min_big']['betHdp_h']}} @ {{scope.row['min_big']['odds_h']}}
								</div>
							
							</template>
						</el-table-column>
						<el-table-column label="皇冠联赛">
							<template slot-scope="scope">
								<div style="text-align: center">
								{{scope.row['hga_team']['league']}}
								<br/>-&#45;&#45;&#45;&#45;<br/>
								{{scope.row['hga_team']['team_h']}} 🆚 {{scope.row['hga_team']['team_c']}}
								</div>
							</template>
						</el-table-column>
						<el-table-column label="平博联赛">
							<template slot-scope="scope">
								<div style="text-align: center">
									{{scope.row['ps_team']['league']}}
									<br/>-&#45;&#45;&#45;&#45;<br/>
									{{scope.row['ps_team']['team_h']}} 🆚 {{scope.row['ps_team']['team_c']}}
								</div>
							</template>
						</el-table-column>
						<el-table-column label="平博赔率 VS 皇冠赔率">
							<template slot-scope="scope">
								<div style="display: flex;align-items: center;justify-content: center">
									<div>
										<span>{{scope.row['ps_odds_data']['betHdp_h']}}</span>
										<br/>
										主队:<span>{{scope.row['ps_odds_data']['odds_h']}}</span>
										<br/>
										<span>{{scope.row['ps_odds_data']['betHdp_c']}}</span>
										<br/>
										客队:<span>{{scope.row['ps_odds_data']['odds_c']}}</span>
									</div>
									<div style="padding: 0 10px;"> 🆚 </div>
									<div>
										<span>{{scope.row['hga_odds_data']['betHdp_h']}}</span>
										<br/>
										主队:<span>{{scope.row['hga_odds_data']['odds_h']}}</span>
										<br/>
										<span>{{scope.row['hga_odds_data']['betHdp_c']}}</span>
										<br/>
										客队:<span>{{scope.row['hga_odds_data']['odds_c']}}</span>
									</div>
								</div>
							</template>
						</el-table-column>
						<el-table-column prop="odds_diff" label="平博水位差"></el-table-column>
						<el-table-column prop="bet_count_odds" label="平皇合水值"></el-table-column>
						<el-table-column label="下单状态">
							<template slot-scope="scope">
								<span style="color: green" v-if="scope.row['bet_status'] == 1">{{scope.row['bet_message']||""}}</span>
								<span style="color: red" v-else>{{scope.row['bet_message']||""}}</span>
							</template>
						</el-table-column>
					</el-table>
				</el-tab-pane>
				<el-tab-pane label="协议跟单" name="agreement">
					<el-table :data="agreementBetList" border style="width: 100%;height: 100%;">
						<el-table-column prop="bet_time" label="中单时间"></el-table-column>
						<el-table-column label="开赛时间">
							<template slot-scope="scope" v-if="scope.row['hga_team']">
								{{scope.row['hga_team']['time_str']}}
								<br/>
								赛中时间：{{~~(Math.abs(scope.row['hga_team']['diff_time'])/60)}}分{{ Math.abs( scope.row['hga_team']['diff_time']) - ((~~(Math.abs(scope.row['hga_team']['diff_time'])/60)) * 60) }}秒
							</template>
						</el-table-column>
						<el-table-column label="皇冠联赛">
							<template slot-scope="scope" v-if="scope.row['hga_team']">
								<div style="text-align: center">
									{{scope.row['hga_team']['lName']}}
									<br/>-&#45;&#45;&#45;&#45;<br/>
									{{scope.row['hga_team']['team_h']}} 🆚 {{scope.row['hga_team']['team_c']}}
								</div>
							</template>
						</el-table-column>
						<el-table-column label="当前比分">
							<template slot-scope="scope" v-if="scope.row['hga_team']">
								<div style="text-align: center">
									{{scope.row['hga_team']['score_h_c']}}
								</div>
							</template>
						</el-table-column>
						<el-table-column label="下注类型">
							<template slot-scope="scope">
								{{wTypeList[scope.row['wtype']]}}
							</template>
						</el-table-column>
						<el-table-column label="下单状态">
							<template slot-scope="scope">
								<span style="color: green" v-if="scope.row['bet_status'] == 1">{{scope.row['bet_message']||""}}</span>
								<span style="color: red" v-else>{{scope.row['bet_message']||""}}</span>
							</template>
						</el-table-column>
					</el-table>
				</el-tab-pane>
			</el-tabs>
		</el-card>
		<div style="height: 20px;"></div>
		<el-card class="box-card">
			<div slot="header" class="box-card-header clearfix">
				<span>日志区</span>
			</div>
			<div class="home-logs">
				<ul>
					<li v-for="item in storeLogs.logs">
						{{item}}
					</li>
				</ul>
			</div>
		</el-card>
	</div>
</template>

<script>

// import clipboard from "clipboardy";
import {platform} from "os";

const { clipboard } = require('electron')


const qs = require("qs");

import {userLogsStore} from "@/store/logs"
import {configStore} from "@/store/config"
import {userDiffOrderStore} from "@/store/diffOrder";

import {delay, formatTime, nameGuanTeam} from "@/utils/utils";
import {getParAccountBalance, loadParDataList, partLogin} from '@/api/part987_api';
import {betHgaOrder, getHgaBalance, loadHgaGameList, toHgaLogin, getOrderList, loadHgaDoingGameList, betAgreementHgaOrder, getHgaGameInfo} from '@/api/hga_api';

import {diff_game} from '@/utils/diff_game';

import {getOrderKeyCount, updateSucBetStatus, getRandomBetType, getLeagueDisableList, loadPsToHgaNameList, updateClientOnlineStatus, getLastOneKey, loadLeagueDisableList, updateErrBetStatus} from '@/api/tdc_api';

import moment, {fn} from "moment";
import {ipcRenderer} from "electron";
import WebSocketService from "@/utils/WebSocketClient";
import Vue from "vue";
import {getDomainUrl} from "../../utils/utils";

let storeLogs = userLogsStore();
let storeConfig = configStore();

let storeDiffOrder = userDiffOrderStore();

let loadPsToHgaTime;
let getRandomBetTypeTime;
let orderHgaInfoTime;

let wsClient;
let wsSendTime;
let orderHgaTime;

let wsBetClient;
let wsBetSendTime;


let loadHgaGameListTimeout;
let loadPsGameListTimeout;

export default {
	data() {
		return {
			/// 每天下注成功的数量
			sucOrderCount:{},
			
			
			domain_url: getDomainUrl(),
			is_dev:process.env.NODE_ENV === 'development',
			wTypeList: {
				'R':  '全场让球',
				'OU':  '全场大小球',
				'RE': '全场让球', //全场让球
				'HR': '上半场让球', //上半场让球
				'HRE': '上半场让球', //上半场让球
				'HOU': '上半场大小球',//全场大小球,
				'ROU': '全场大小球', //全场大小球,
				'HROU': '上半场大小球', //上半场大小球
			},
			
			has_bet: false,
			has_cancel_bet: false,
			
			has_agreement_bet: false,

			betTypeConfig: {
				'concede_points':"全场让球",
				'r_concede_points':"上半场让球",
				"min_big": "全场大小球",
				"r_min_big": "上半场大小球",
			},

			storeConfig: storeConfig,
			storeLogs: storeLogs,
			storeDiffOrder: storeDiffOrder,
			activeName: "game",

			gameParList:[], /// 平博游戏列表
			par987LoginStatus: 0, /// 平博登录状态
			par987UserInfo: {}, /// 平博用户信息

			gameHgaList:[], /// 黄瓜游戏列表
			hgaLoginStatus: 0, /// 黄瓜登录状态
			hgaUserInfo:{}, /// 黄瓜用户信息

			nameGuanTeam: {}, /// PS_HGA 关联比赛
			
			agreementBetList: [], /// 协议中单列表
			webSocketOnline: false,
			
			hgaDoingGameList: [],
			hgaWarnGameList: [],
			
			warnDoingCount: [0,0,0,0],
			
			isBetOrderStatus: false,
			
			disableDayList:{}
		}
	},
	computed:{
		hasBetType:function (){
			let betTypeList = storeConfig.setting.bet_type_list.filter(function (_item) {
				return _item['checked'];
			})
			return betTypeList.length > 0;
		}
	},
	methods:{
		
		/// 下注状态切换
		switchHasBet(e){
			storeConfig.updateBetStatus(e);
		},
		
		/// 获取PS关联比赛信息
		getHgaToPsGameInfo(item){
			let competition = item['competition'];
			let one_key = `${competition['time_str']}_${competition['team_h']}`;
			let one_key2 = `${competition['time_str']}_${competition['team_c']}`;
			let ps_one_key = this.nameGuanTeam[one_key]||this.nameGuanTeam[one_key2]||null;
			let psGameList = this.gameParList.filter((_item) => {
				let _competition = _item['competition'];
				let _one_key = `${_competition['time_str']}_${_competition['team_h']}`;
				let _one_key2 = `${_competition['time_str']}_${_competition['team_c']}`;
				return ps_one_key === _one_key || ps_one_key === _one_key2;
			})
			let ps_name = "";
			if(psGameList.length) {
				let psGameInfo = psGameList[0];
				let competition = psGameInfo['competition'];
				ps_name = competition['league'] + "<br/>" + competition['team_h'] + " <br/>🆚<br/> " + competition['team_c'];
			}
			return ps_name;
		},
		
		/// 获取HGA_PS关联比赛
		nameGuanTeamList(){
			let gameKeyList = nameGuanTeam([...this.gameParList], [...this.gameHgaList]);
			this.nameGuanTeam = {...gameKeyList};
			/// 开始下注
			if(this.has_bet) {
				this.actionDiffOrder();
			}
		},
		
		/// 处理中单逻辑
		async actionDiffOrder() {
			let _this = this;
			// if(this.isBetOrderStatus) {
			// 	return;
			// }
			//
			// this.isBetOrderStatus = true;
			
			let isGetUserInfo = false;
			
			try{
				let diffBetList = diff_game([...this.gameHgaList], [...this.gameParList], {...this.nameGuanTeam}, {...storeConfig.setting});
				for (let i = 0; i < diffBetList.length; i++) {
					let item = diffBetList[i];
					let one_key = item['one_key'];
					
					if (storeDiffOrder.betKeys.indexOf(one_key) === -1) {
						
						let hga_team = item['hga_team'];
						storeDiffOrder.addKey(one_key);
						storeDiffOrder.addInfo(one_key, item);
						
						let keyCountRes = await getOrderKeyCount(one_key);
						console.error([one_key, keyCountRes]);
						if(!keyCountRes['state'] || keyCountRes['data'] > 0) {
							console.error('已有 one_key：' + one_key + " 不进行下单");
							storeLogs.add('已有 one_key：' + one_key + " 不进行下单");
							continue;
						}
						
						storeLogs.add('one_key：' + one_key);
						storeLogs.add('storeDiffOrder.betKeys', JSON.stringify(storeDiffOrder.betKeys));
						
						storeLogs.add(`中单 联赛：${hga_team['league']}，${hga_team['team_h']} VS ${hga_team['team_c']} - ${item['bet_type_str']}`);
						// storeLogs.add(`中单 联赛：${hga_team['league']}，${hga_team['team_h']} VS ${hga_team['team_c']} - ${item['bet_type_str']}`, JSON.stringify(item));
						
						/// 获取比赛详情盘口
						await getHgaGameInfo(hga_team);
						/// 延迟
						await delay(1 * 1000);
						
						item['bet_result'] = await betHgaOrder(item['bet_data'], {
							original_bet_amount: item['bet_amount'],
							bet_hdp: item['bet_hdp']
						}, {...storeConfig.setting}, {...hga_team}, false, one_key,  {...item});
						
						if(item['bet_result']) {
							let bet_result = item['bet_result'];
							item['bet_status'] = bet_result['state'];
							item['bet_message'] = bet_result['message'];
							isGetUserInfo = true;
						}else {
							item['bet_status'] = 0;
							item['bet_message'] = "error";
						}
						
						if(item['bet_status'] == 1) {
							let tempTime = formatTime(new Date((+new Date()) - (12 * 3600 * 1000)) ,"YYYY-MM-DD");
							if(!_this.sucOrderCount[tempTime]) {
								_this.sucOrderCount[tempTime] = 0;
							}
							_this.sucOrderCount[tempTime] += 1;
							
							if(_this.sucOrderCount[tempTime] >= storeConfig.setting.suc_order_max_count) {
								// storeLogs.add('超出每日上限单数：' + _this.sucOrderCount[tempTime] + " _ " + storeConfig.setting.suc_order_max_count );
								let res = await updateSucBetStatus();
								if(res['state']) {
									// ipcRenderer.invoke("quit-app");
								}
								continue;
							}
						}
						
						storeLogs.add("bet_result 结果", JSON.stringify(item['bet_result']));
						console.error(['storeDiffOrder', storeDiffOrder.betInfos], item['bet_result']);
						// storeDiffOrder.betKeys.push(one_key);
						await delay(storeConfig.setting.bet_interval_time * 1000);
					}
				}
			}catch (e){
				console.error(e);
			}
			if(isGetUserInfo) {
				_this.getHgaUserInfo();
			}
			// this.isBetOrderStatus = false;
		},
		
		
		
		/// 获取平博游戏列表
		async getParGameList() {
			
			if(this.$route.path !== '/') {
				loadPsGameListTimeout && clearTimeout(loadPsGameListTimeout);
				return false;
			}
			
			let _this = this;
			let res = await loadParDataList();
			if(!res['state']) {
				this.gameParList = [];
				storeLogs.add('平博 获取游戏列表失败：' + JSON.stringify(res));
				await delay(storeConfig.setting.ps_api_time * 1000);
				_this.getParGameList();
				return false;
			}
			let diff_time = Math.abs( ~~((res.data.sys_time - (+new Date()))/1000));
			if(diff_time > 120) {
				this.gameParList = [];
				storeLogs.add('平博 获取游戏列表差值超过120秒');
				await delay(5 * 1000);
				this.getPar987UserInfo(_this.getParGameList);
				// this.toPar987Login();
				return false;
			}
			this.gameParList = res.data.gameList.filter((item) => {
				let diff_time = item['competition']['diff_time'];
				
				// 只给了2H 29分，这样不知道上半场具体的用时 所以滚球全部给出，黄瓜那边已做过滤
				if(item['competition']['diff_time_type'] === 'doing') {
					diff_time = Math.abs(diff_time);
					return true;
					return diff_time > 0 && diff_time >= storeConfig.setting.doing_game_time_start * 60 && diff_time <= storeConfig.setting.doing_game_time_end * 2 * 60;
				}
				/// 过滤掉 不在指定时间内的比赛
				return diff_time > 0 && diff_time >= storeConfig.setting.game_time_start * 60 && diff_time <= storeConfig.setting.game_time_end * 60;
			});
			
			/*if((new Date()).getSeconds()%5 === 0) {
				let temp = [];
				this.gameParList.forEach((item) => {
					if(item['competition']['diff_time_type'] === 'doing') {
						temp.push({...item.competition});
					}
				})
				console.log(temp);
			}*/
			
			let psWarnCount = 0;
			let psDoingCount = 0;
			this.gameParList.forEach((item) => {
				if(item['competition']['diff_time_type'] === 'doing') {
					psDoingCount += 1;
				}else {
					psWarnCount += 1;
				}
			})
			
			
			this.warnDoingCount[2] = psWarnCount;
			this.warnDoingCount[3] = psDoingCount;
			
			// this.nameGuanTeamList();
			
			
			loadPsGameListTimeout && clearTimeout(loadPsGameListTimeout);
			loadPsGameListTimeout = setTimeout(function () {
				_this.getParGameList();
			}, storeConfig.setting.ps_api_time * 1000);
			
			// await delay(storeConfig.setting.ps_api_time * 1000);
			
		},
		
		/// 平博用户信息
		async getPar987UserInfo(callback){
			let res = await getParAccountBalance();
			if(res['state']){
				storeLogs.add('平博 获取余额成功');
				this.par987UserInfo = {
					update_time: moment().format("HH:mm:ss"),
					...res.data
				};
				await delay(5 * 1000);
				callback && callback();
			}else {
				storeLogs.add('平博 获取余额失败：' + JSON.stringify(res));
				this.$message.warning("获取平博余额失败");
				if(callback) {
					storeLogs.add('HGA 登录失败 5秒再试');
					/// 10重试
					await delay(1000 * 10);
					await this.toPar987Login();
				}
				
			}
		},
		/// 平博登录
		async toPar987Login() {
			
			loadPsGameListTimeout && clearTimeout(loadPsGameListTimeout);
			
			if(!storeConfig.setting.ps_user_name || !storeConfig.setting.ps_password) {
				this.$message.error("平博账号和密码不能为空");
				return false;
			}
			
			if(this.par987LoginStatus === 1) {
				return false;
			}
			
			this.par987LoginStatus = 1;
			
			storeLogs.add("平博 登录中");
			
			let res = await partLogin({
				"captcha": "",
				"captchaToken": "",
				"loginId": storeConfig.setting.ps_user_name,
				"password": storeConfig.setting.ps_password,
			});
			if (res['state']) {
				this.par987LoginStatus = 2;
				storeLogs.add('平博 登录成功');
				storeLogs.add('平博 开始获取余额');
				await delay()
				await this.getPar987UserInfo();
				await delay(1000);
				this.getParGameList();
			}else {
				this.par987LoginStatus = 0;
				storeLogs.add("平博 登录失败 10秒重试");
				
				/// 10重试
				await delay(1000 * 10);
				this.toPar987Login();
				
			}
		},
		
		/// 复制HAG登录地址
		async copyHgaLoginUrl() {
			if(this.hgaLoginStatus !== 2) {
				this.$message.warning("请先登录");
				return false;
			}
			let info = this.hgaUserInfo;
			
			let keys = ['uid', 'pay_type', 'username', 'passwd_safe', 'mid', 'ltype', 'odd_f', 'odd_f_type', 'four_pwd', 'abox4pwd_notshow'];
			
			let arr = []
			keys.forEach((key) => {
				arr[key] = info[key]||"";
			})
			let url = info['domain_url'] + "/?cu=Y&" + qs.stringify(arr) + "&langx=zh-cn";
			storeLogs.add(url);
			
			const textarea = document.createElement('textarea');
			textarea.value = url;
			document.body.appendChild(textarea);
			
			// 选择文本并复制
			textarea.select();
			document.execCommand('copy');
			// 移除隐藏的文本输入框
			document.body.removeChild(textarea);
			this.$message.success("复制成功");
			/*let platformName = platform().includes('win32') ? 'win' : platform().includes('darwin') ? 'mac' : 'linux'
			
			if(platformName === 'linux') {
				this.$alert('<textarea style="width:100%;height:100px;">'+url+'</textarea>', '请自行复制登录地址', {
					dangerouslyUseHTMLString: true,
					showConfirmButton:false
				});
			}else {
				clipboard.writeText(url);
				this.$message.success("复制成功");
			}*/
		},
		

		/// 获取HGA游戏列表
		async getHgaGameList() {
			if(this.$route.path !== '/') {
				loadHgaGameListTimeout && clearTimeout(loadHgaGameListTimeout);
				return false;
			}
			let _this = this;
			
			/// 没有下注类型，不发送黄瓜请求
			if(!_this.hasBetType) {
				loadHgaGameListTimeout && clearTimeout(loadHgaGameListTimeout);
				loadHgaGameListTimeout = setTimeout(function (){
					_this.getHgaGameList();
				}, storeConfig.setting.hga_api_time * 1000);
				// await delay(storeConfig.setting.hga_api_time * 1000);
				// _this.getHgaGameList();
				return false;
			}
			
			/// 获取比赛前
			let res;
			if(storeConfig.setting.open_today_game) {
				res = await loadHgaGameList();
				if(!res['state']) {
					this.gameHgaList = [];
					storeLogs.add('HGA 获取游戏列表失败：' + JSON.stringify(res));
					await delay(10 * 1000);
					this.getHgaUserInfo(_this.getHgaGameList);
					return false;
				}
			}else {
				res = {
					data:[]
				}
			}
			
			
			let warnGameList = (res.data || []);
			
			/// 获取滚球
			res = null;
			if(storeConfig.setting.open_doing_game) {
				res = await loadHgaDoingGameList();
				if(!res['state']) {
					this.gameHgaList = [];
					storeLogs.add('HGA 获取滚球游戏列表失败：' + JSON.stringify(res));
					await delay(10 * 1000);
					this.getHgaUserInfo(_this.getHgaGameList);
					return false;
				}
			}else {
				res = {
					data:[]
				}
			}
			
			let doingGameList = (res.data || []);
			/// 合并赛事
			
			this.gameHgaList = [...warnGameList,...doingGameList].filter((item) => {
				let competition = item['competition'];
				let diff_time =  Math.abs(competition['diff_time']);
				let league = competition['league'];
				
				if(competition['team_h'].indexOf('角球') !== -1) {
					return false;
				}
				if(competition['team_c'].indexOf('角球') !== -1) {
					return false;
				}
				/// 过滤联赛
				let filterLeagueList = storeConfig.leagueDisable.filter((leagueName) => {
					return league.indexOf(leagueName) !== -1;
				})
				if(filterLeagueList.length) {
					return false;
				}
				/// 过滤掉 不在指定时间内的比赛
				
				/// 滚球
				if(competition['diff_time_type'] === 'doing') {
					return diff_time > 0 && diff_time >= storeConfig.setting.doing_game_time_start * 60 && diff_time <= storeConfig.setting.doing_game_time_end * 60;
				}
				/// 赛前
				return diff_time > 0 && diff_time >= storeConfig.setting.game_time_start * 60 && diff_time <= storeConfig.setting.game_time_end * 60;
			});
			let warnHgaCount = 0;
			let doingHgaCount = 0;
			this.gameHgaList.forEach((item) => {
				let competition = item['competition'];
				if(competition['diff_time_type'] === 'doing') {
					doingHgaCount += 1;
				}else {
					warnHgaCount += 1;
				}
			})
			
			this.warnDoingCount[0] = warnHgaCount;
			this.warnDoingCount[1] = doingHgaCount;
			
		
			this.nameGuanTeamList();

			
			
			loadHgaGameListTimeout && clearTimeout(loadHgaGameListTimeout);
			loadHgaGameListTimeout = setTimeout(function (){
				_this.getHgaGameList();
			}, storeConfig.setting.hga_api_time * 1000);
			
		},

		/// HGA用户信息
		async getHgaUserInfo(callback, has_get = false) {
			
			/// 没有下注类型，不发送黄瓜请求
			if(!has_get && !this.hasBetType) {
				return false;
			}
			
			let res = await getHgaBalance();
			if (res['state']) {
				storeLogs.add('HGA 获取余额成功');
				this.hgaUserInfo = {
					update_time: moment().format("HH:mm:ss"),
					...res.data
				};
				callback && callback();
			}else {
				storeLogs.add('HGA 获取余额失败：' + JSON.stringify(res));
				this.$message.warning("获取HGA余额失败");
				storeLogs.add('HGA 登录失败 5秒再试');
				if(callback) {
					/// 10重试
					await delay(1000 * 10);
					await this.toHGALogin();
				}
			}
		},
		/// HGA登录
		async toHGALogin() {
			
			loadHgaGameListTimeout && clearTimeout(loadHgaGameListTimeout);
			
			let _this = this;
			if(!storeConfig.setting.hga_user_name || !storeConfig.setting.hga_password) {
				this.$message.error("HGA账号和密码不能为空");
				return false;
			}

			if(this.hgaLoginStatus === 1) {
				return false;
			}

			this.hgaLoginStatus = 1;

			storeLogs.add("HGA 登录中");
			let hgaUserInfo = await toHgaLogin({
				username : storeConfig.setting.hga_user_name,
				password : storeConfig.setting.hga_password
			});
			if(hgaUserInfo['state']) {
				this.hgaLoginStatus = 2;
				storeLogs.add('HGA 登录成功');
				storeLogs.add('HGA 开始获取余额');
				await delay(3 * 1000);
				await this.getHgaUserInfo(null, true);

				await delay(1000 * 5);
				this.getHgaGameList();
				
				setTimeout(async function () {
					let res = await getOrderList();
					_this.actionOrderCancel(res);
				}, 5 * 1000);
				
			}else {
				this.hgaLoginStatus = 0;
				storeLogs.add('HGA 登录失败 10秒再试');
				/// 10重试
				await delay(1000 * 10);
				this.toHGALogin();
			}
		},
		
		/// 更新同步其它端 下注的one_key
		async updateOrderKeysList() {
			let res = await getLastOneKey();
			if(res['state']) {
				let data = res['data']||[];
				console.error("updateOrderKeysList", data);
				data.forEach((one_key) => {
					if(storeDiffOrder.betKeys.indexOf(one_key) === -1) {
						storeLogs.add("添加 其它端没有的订单： " + one_key);
						storeDiffOrder.addKey(one_key);
					}
				})
			}
		},
		
		
		// 协议跟单
		switchHasAgreement(e) {
			if(!storeConfig.setting.hga_user_name) {
				this.has_agreement_bet = false;
				this.$message.error('请输入HGA账号');
				return false;
			}
			this.closeWebSocket();
			if(e) {
				this.initWebSocket();
			}
		},
		closeWebSocket(){
			wsClient && wsClient.close();
			wsClient = null;
			
			wsSendTime && clearInterval(wsSendTime);
			wsSendTime = null;
			this.webSocketOnline = false;
		},
		/// 协议跟单
		initWebSocket() {
			
			let _this = this;
			wsClient && wsClient.close();
			wsClient = null;
			
			wsSendTime && clearInterval(wsSendTime);
			wsSendTime = null;
			
			this.webSocketOnline = true;
			
			// wsClient = new WebSocketService('wss://cc.w115.net/wss');
			wsClient = new WebSocketService( 'wss://t.long.bid/ball/betplace?device=app&version=' + Vue.app_version);
			
			wsClient.onMessage((message) => {
				if(message !== 'pong') {
					storeLogs.add('长链接推送：' + message);
					let json = JSON.parse(message);
					if(json.type === 'betdata') {
						let data = json.data || {};
						let list = data['wagers'] || [];
						list.forEach((item) => {
							_this.betAgreementBet(item);
						})
					}
				}
				// console.log('处理消息:', json);
			});
			
			wsClient.onError((error) => {
				this.webSocketOnline = false;
				console.error('处理错误:', error);
			});
			
			wsClient.onClose(() => {
				this.webSocketOnline = true;
				console.log('连接关闭，执行其他操作');
			});
			// 连接 WebSocket
			wsClient.connect();
			
			wsClient.onOpen(() => {
				// 发送消息
				wsClient.send('ping');
			});
			
			wsSendTime = setInterval(function () {
				wsClient.send('ping');
			}, 30 * 1000);
		},
		/// 协议下单
		async betAgreementBet(data) {
			
			
			/// 协议跟单类型逻辑 开始
			/// 判断 是不是大小类型
			let has_min_big = false;
			if(['OU','HOU', 'ROU', 'HROU'].indexOf(data['wtype']) !== -1) {
				has_min_big = true;
			}
			
			let bet_type_list = storeConfig.setting.bet_type_list;
			let typeList = [];
			for (let i=0;i<bet_type_list.length;i++) {
				let _item = bet_type_list[i];
				if(_item['checked']) {
					typeList.push(_item['type']);
				}
			}
			if(typeList.length < 1) {
				storeLogs.add("服务器未分配下注类型，不用跟单", data);
				return false;
			}else {
				let typeList_str = typeList.join(",");
				// 下注类型是 大小盘口
				if(typeList_str.indexOf("min_big") !== -1) {
					/// 如果协议单 不是大小盘 就不跟
					if(!has_min_big) {
						storeLogs.add("服务器大小下注类型，跟单类型不是大小时_" + typeList_str, data);
						return false;
					}
					storeLogs.add("服务器大小下注类型，跟单类型大小_" + typeList_str, data);
				}else {
					/// 其它下注类型
					storeLogs.add("服务器让球下注类型，跟单类型让球_" + typeList_str, data);
				}
			}
			/// 协议跟单类型逻辑 结束
			
			
			// storeConfig.setting['bet']
			// let has_bet_type = config['bet_type_list'].filter((bet_type) => {
			// 	return bet_type['checked'] && bet_type['type'] === `${_item['type']}_${hasType}`;
			// })
			
			
			
			let random_number = (Math.random() * (storeConfig.setting['agreement_bet_time_end']*1 + 1 - storeConfig.setting['agreement_bet_time_start']*1)) + (storeConfig.setting['agreement_bet_time_start'] * 1);
			random_number =  Math.floor( random_number * 1000);
			storeLogs.add('延时执行' + random_number + '毫秒');
			await delay(random_number);
			storeLogs.add('开始执行协议跟单');
			
			let amount_list = storeConfig.setting.agreement_amount_list.filter(item => {
				return item.checked;
			})
			
			let original_bet_amount = data['gold']*1;
			
			let bet_amount = 0;
			for (let i = 0; i < amount_list.length; i++) {
				let item = amount_list[i];
				if(original_bet_amount >= item['range_start'] && original_bet_amount <= item['range_end']) {
					bet_amount = item['amount'] * 1;
				}
			}
			
			if(bet_amount == 0) {
				storeLogs.add('未匹配到对应下注金额');
				return false;
			}
			if(bet_amount < 50) {
				bet_amount = 50;
			}
			
			
			let item = {
				...data
			}
			item['golds'] = bet_amount;
			
			item['bet_result'] = await betAgreementHgaOrder(item, {...storeConfig.setting});
			if (item['bet_result']) {
				let bet_result = item['bet_result'];
				item['bet_status'] = bet_result['state'];
				item['bet_message'] = bet_result['message'];
				
				let res2 = bet_result['data'] || {};
				item['hga_team'] = {
					'lName': res2['league'],
					'team_h': res2['team_h'],
					'team_c': res2['team_c'],
					'score_h_c': res2['score_h'] + "-" + res2['score_c'],
					"time_str": res2['date'] + " " + res2['time']
				};
				item['wtype'] = res2['wtype'];
				item['gold'] = res2['gold'];
				
			} else {
				item['bet_status'] = 0;
				item['bet_message'] = "error";
			}
			item['bet_time'] = formatTime();
			
			/*let item = {
				...data['hga'],
				'bet_id': data['bet_id'],
				'golds': bet_amount,
			};
			
			let hga_team = {};
			if(data['hga_team']) {
				hga_team = JSON.parse(data['hga_team']);
			}
			
			let bet_data = {
				original_bet_amount: bet_amount,
				bet_hdp: data['hga']['bet_hdp'] * 1
			}
			item['bet_result'] = await betHgaOrder(item, bet_data, {
				...storeConfig.setting,
				'bet_min_odds': storeConfig.setting.agreement_bet_min_odds,
			}, hga_team, true);
			
			if (item['bet_result']) {
				let bet_result = item['bet_result'];
				item['bet_status'] = bet_result['state'];
				item['bet_message'] = bet_result['message'];
			} else {
				item['bet_status'] = 0;
				item['bet_message'] = "error";
			}
			
			item['hga_team'] = hga_team;
			item['bet_time'] = formatTime();*/
			console.error(['协议跟单', {...item}]);
			storeLogs.add("协议跟单", JSON.stringify(item));
			this.agreementBetList.push(item);
		},
		// 省略部分代码
		async checkUpgrade() {
			let _this = this;
			storeLogs.add('热更新 启动');
			// storeLogs.add('热更新 启动');
			// 请注意，ipcRenderer为electron提供的ipcRenderer方法
			ipcRenderer.invoke("hot-update");
		},
		/// 出现非投就取消下注
		async actionOrderCancel(data) {
			let _this = this;
			let list = data || [];
			let has_err = false;
			list.forEach((item) => {
				if (!_this.has_cancel_bet && item['ball_act_ret'] && item['ball_act_ret'].indexOf('非正常投注') !== -1) {
					storeLogs.add('出现非投 ' + JSON.stringify(item));
					has_err = true;
					_this.has_bet = false;
				}
			})
			/// 出现关掉软件
			if (has_err) {
				let res = await updateErrBetStatus();
				if(res['state']) {
					ipcRenderer.invoke("quit-app");
				}
			}
		},
		
		
		/// 组合用户状态数据
		getUserStatusInfo() {
			
			let maxcredit = this.hgaUserInfo['maxcredit']||0;
			let hgaLoginStatus= this.hgaLoginStatus;
			let par987LoginStatus = this.par987LoginStatus;
			let version = Vue.app_version;
			let has_bet = this.has_bet ? 1 : 0;
			let has_agreement_bet = this.has_agreement_bet ? 1 : 0;
			
			let bet_list = storeConfig.setting.bet_type_list.filter((item) => {
				return !!item.checked;
			})
			let bet_type_list = [];
			bet_list.forEach((item) => {
				bet_type_list.push(item.type);
			})
			let has_bet_server = storeConfig.setting.has_bet_server ? 1 : 0;
			
			let from = {
				"new_user_name": storeConfig.setting.hga_user_name,
				"bet_type_list": bet_type_list.join(","),
				"has_bet_server": has_bet_server,
				"balance": maxcredit||0,
				'hga_login_status': hgaLoginStatus,
				'par_login_status': par987LoginStatus,
				'version': version,
				'has_bet': has_bet,
				'has_agreement_bet': has_agreement_bet
			};
			return from;
		},
		/// 获取下注类型长链接
		closeBetWebSocket(){
			wsBetClient && wsBetClient.close();
			wsBetClient = null;
			wsBetSendTime && clearInterval(wsBetSendTime);
			wsBetSendTime = null;
		},
		initBetWebSocket() {
			
			let _this = this;
			
			this.closeBetWebSocket();
			
			
			// if(this.is_dev) {
			// 	return;
			// }
			
			
			// wsClient = new WebSocketService('wss://cc.w115.net/wss');
			
			// let url = process.env.NODE_ENV === 'development' ? 'ws://127.0.0.1:9508' : 'wss://tdc.w115.net/bet_wss';
			// if(process.env.DOMAIN_URL === 'dd') {
			// 	url = "wss://dd.w115.net/bet_wss";
			// 	/// 第二个域名
			// }
			let url = "wss://" + getDomainUrl() + "/bet_wss";
			if(this.is_dev) {
				url = "ws://127.0.0.1:9508";
			}
			
			wsBetClient = new WebSocketService(url);
			
			wsBetClient.onMessage((message) => {
				// storeLogs.add('长链接推送：' + message);
				let res = JSON.parse(message);
				if (res['state']) {
					if(res['code'] == 1) {
						storeConfig.setting.has_bet_server && storeConfig.updateSettingBetTypeList(res.data);
					}
					if(res['code'] == 2) {
						this.updateOrderKeysList();
					}
					if(res['code'] == 3) {
						this.has_bet = true;
					}
					if(res['code'] == 4) {
						this.has_bet = false;
					}
					if(res['code'] == 5) {
						/// 自动更新版本
						storeLogs.add("自动更新");
						_this.checkUpgrade();
					}
					if(res['code'] == 6) {
						/// 黄瓜自动登录
						storeLogs.add("黄瓜自动登录：" + _this.hgaLoginStatus );
						if(_this.hgaLoginStatus != 2) {
							_this.toHGALogin();
						}
					}
					if(res['code'] == 7) {
						storeLogs.add("平博自动登录：" + _this.par987LoginStatus);
						if(_this.par987LoginStatus != 2) {
							_this.toPar987Login();
						}
						/// 平博自动登录
					}
					if(res['code'] == 14) {
						_this.has_agreement_bet = true;
						_this.switchHasAgreement(true);
						storeLogs.add("开启协议跟单：" + _this.has_agreement_bet);
						/// 平博自动登录
					}
					if(res['code'] == 15) {
						_this.has_agreement_bet = false;
						_this.switchHasAgreement();
						storeLogs.add("关启协议跟单：" + _this.has_agreement_bet);
						/// 平博自动登录
					}
				}
				updateClientOnlineStatus(this.hgaUserInfo['maxcredit']||0, this.hgaLoginStatus, this.par987LoginStatus, Vue.app_version, this.has_bet ? 1 : 0, this.has_agreement_bet ? 1 : 0);
				// console.log('处理消息:', res);
			});
			
			wsBetClient.onError((error) => {
				console.error('处理错误:', error);
			});
			
			wsBetClient.onClose(() => {
				console.log('连接关闭，执行其他操作');
			});
			// 连接 WebSocket
			wsBetClient.connect();
			
			wsBetClient.onOpen(() => {
				// 发送消息
				// wsBetClient.send(JSON.stringify(_this.getUserStatusInfo()));
				wsBetClient.send(storeConfig.setting.hga_user_name);
			});
			
			wsBetSendTime = setInterval(function () {
				// wsBetClient.send(JSON.stringify(_this.getUserStatusInfo()));
				wsBetClient.send(storeConfig.setting.hga_user_name);
			}, 15 * 1000);
		},
		
		/*betSendTimeOutFun(wsBetClient){
			let _this = this;
			wsBetSendTime && clearTimeout(wsBetSendTime);
			wsBetSendTime = setTimeout(function () {
				wsBetClient.send(storeConfig.setting.hga_user_name);
				_this.betSendTimeOutFun(wsBetClient);
			}, 15 * 1000);
		},*/
		
		handleTabClick() {
		
		},
		initWinUpdateEvent(){
			let _this = this;
			storeConfig.updateInitHotUpdate();
			ipcRenderer.on("hot-update-status", async (event, msg) => {
				console.log(msg);
				switch (msg.status) {
					case "version":
						_this.$message.warning("已经是最新版");
						break;
					case "downloading":
						storeLogs.add("新版本：文件下载中...");
						//   正在下载
						break;
					case "moving":
						storeLogs.add("新版本：更新文件中...");
						//   正在移动文件
						break;
					case "finished":
						storeLogs.add("新版本：更新完成，请重启软件生效！");
						try {
							ipcRenderer.invoke("restart-app");
							/*
							let res = await _this.$confirm("是否重启软件，生效新版本");
							if (res === 'confirm') {
								ipcRenderer.invoke("restart-app");
							}*/
						} catch (e) {}
						//   完成更新
						break;
					case "failed":
						storeLogs.add("新版本：完成失败 " + JSON.stringify(msg));
						//   更新失败
						break;
					default:
						storeLogs.add("新版本：其它 " + JSON.stringify(msg));
						break;
				}
			})
		}
	},
	beforeDestroy(){
		this.closeBetWebSocket();
		this.closeWebSocket();
		orderHgaTime && clearInterval(orderHgaTime);
		loadPsToHgaTime && clearInterval(loadPsToHgaTime);
		getRandomBetTypeTime && clearInterval(getRandomBetTypeTime);
		orderHgaInfoTime && clearInterval(orderHgaInfoTime);
		
		loadPsGameListTimeout && clearTimeout(loadPsGameListTimeout);
		loadHgaGameListTimeout && clearTimeout(loadHgaGameListTimeout);
		
	},
	async created() {
		
		let _this = this;
		
		/// 每隔一小时获取 用于关联的名字库
		loadPsToHgaNameList();
		loadLeagueDisableList();
		loadPsToHgaTime = setInterval(function () {
			loadPsToHgaNameList();
			loadLeagueDisableList();
		}, 60 * 60 * 1000);
		
		/// 0秒或30秒获取下 分配的下注类型
		// getRandomBetTypeTime = setInterval(async function () {
		// 	let now = new Date();
		// 	let seconds = now.getSeconds();
		// 	if (seconds === 0 || seconds === 30) {
		// 		getRandomBetType();
		// 	}
		// }, 1000);
		// getRandomBetType();
		
		/// 每5秒获取下比赛结果提交
		orderHgaTime = setInterval(async function () {
			if (_this.hgaLoginStatus === 2) {
				
				/// 没有下注类型，不发送黄瓜请求
				if(!_this.hasBetType) {
					return false;
				}
				
				_this.getHgaUserInfo();
				let res = await getOrderList();
				_this.actionOrderCancel(res);
			}
		}, 2 * 60 * 1000);
		
		// orderHgaInfoTime = setInterval(function () {
		// 	_this.getHgaUserInfo();
		// }, 3 * 60 * 1000);
		
		
		this.updateOrderKeysList();
		
		this.initBetWebSocket();
		
		ipcRenderer.send('updateUserAgent', storeConfig.setting.bet_user_agent);
		
		if(!storeConfig.initHotUpdate) {
			this.initWinUpdateEvent();
		}
		
	}
}
</script>

<style scoped lang="scss">
.box-card-header {
	font-weight: bold;
}
.app-container {
	display: flex;
	height: 100%;
	flex-direction: column;
}
.container-list {
	flex: 1;
	height: 1px;
	//overflow-y: auto;
}

.home-logs {
	height: 90px;
	font-size: 14px;
	line-height: 1.8;
}
.home-logs ul {
	height: 100%;
	overflow-y: auto;
}
ul,li {
	padding:0;
	margin: 0;
	list-style: none;
}
</style>
<style type="text/css">
.el-table__body-wrapper{
	overflow: auto;
	height: calc(100% - 45px);
}
.container-list .el-card__body,
.container-list .el-card__body .el-tabs,
.container-list .el-card__body .el-tab-pane,
.container-list .el-card__body .el-tabs__content {
	height: 100%;
}
.container-list .el-card__body .el-tabs__content {
	height: calc(100% - 45px);
}
</style>